/**
 * 
 */
package com.fsoft.tinhcd.app;

import java.util.Date;

import org.hibernate.Session;

import com.fsoft.tinhcd.entity.Department;
import com.fsoft.tinhcd.entity.Employee;
import com.fsoft.tinhcd.utils.HibernateUtils;

/**
 * @author caodangtinh
 * 
 */
public class App {
	public static void main(String[] args) {
		HibernateUtils hibernateUtils = new HibernateUtils();
		Session session = hibernateUtils.getSessionFactory().openSession();
		session.getTransaction().begin();
		Department department = new Department();
		department.setDepartmentName("Sales");
		session.save(department);
		Employee employee = new Employee("cao", "dang tinh", new Date(),
				"0915226558");
		Employee employee2 = new Employee("pham", "hongha", new Date(),
				"01253296079");
		employee.setDepartment(department);
		employee2.setDepartment(department);
		session.save(employee);
		session.save(employee2);
		session.getTransaction().commit();
		session.close();
	}
}
